<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>办公自动化管理系统</title>
<link href="/baoxiao/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/baoxiao/css/jquery-1.4.2.min.js"></script>
<script type="text/javascript"> 
var isIE = !!document.all;
function AddOption()
{
	var voteoptions = document.getElementById("options");
	var td1 = document.getElementById("td1");
	var td2 = document.getElementById("td2");
	var td3 = document.getElementById("td3");
	var _tr = document.createElement("tr");
	var _select = document.createElement("select");
	_select.setAttribute("name","select");
	_select.className="input_01";
	_select.options[0] = new Option("基本通讯费用", "");
	_select.options[1] = new Option("费用", "");
	
	td1.appendChild(_select);
	var _input = document.createElement("input");
	_input.type = "text";
	_input.className = "input_01";
	_input.setAttribute("name", "feiyong");
	td2.appendChild(_input);
	var _input = document.createElement("input");
	_input.type = "text";
	_input.className = "input_01";
	_input.setAttribute("name", "shuoming");
	td3.appendChild(_input);
	if(isIE) {
		_a.attachEvent("onclick", DelOption);
	} else {
		_a.addEventListener("click", DelOption, false);
	}

	_a.appendChild(document.createTextNode("删除"));
	td3.appendChild(_a);
	_tr.appendChild(td1);
	_tr.appendChild(td2);
	_tr.appendChild(td3);
	
	voteoptions.appendChild(_tr);
}

function DelOption(e)
{
	if(!e) e = window.event;
	var a = e.srcElement || e.target;
	var obj = a.parentNode;
	obj.parentNode.removeChild(obj);
}
$(function(){
	$("input[type='text']").blur(function(){
			var price=0;
			var sumprice=0;
			var myTableTr=document.getElementById("options").getElementsByTagName("td").getAttribute("td2");
			for(var i=0;i<myTableTr.length;i++){

			price=myTableTr[i].value;
			sumprice+=parseInt(price);
			}
			$("#sum").html("￥"+parseInt(sumprice));
			alert(sumprice);
		});
})
</script>
</head>

<body>
<div class="top"><div class="global-width"></div></div>
<div class="status"><div class="global-width"><span class="usertype">【登录角色：<s:property value="#session.role"/>】</span><s:property value="#session.user.uname"/>你好！欢迎访问使用办公管理系统！</div></div>
<div class="main"><div class="global-width">
	
	<div class="nav" id="nav">
    	<div class="t"></div>
    	<dl class="open">
        	<dt onclick="this.parentNode.className=this.parentNode.className=='open'?'':'open';">报销单管理</dt>
            <dd><a href="/baoxiao/index.jsp" target="_self">添加报销单</a></dd>
            <dd><a href="/baoxiao/list.jsp" target="_self">审核报销单</a></dd>
        </dl>
    </div>
    <div class="action">
    	<div class="t">增加报销单</div>
   		<div class="pages">
        	<!--增加报销单 区域 开始-->
                <table width="90%" border="0" cellspacing="0" cellpadding="0" class="addform-base">
                  <caption>基本信息</caption>
                  <tr>
                    <td width="36%">填写人：<s:property value="#session.user.uname"/></td>
                   
   					 <%
                    	Calendar c=Calendar.getInstance();
                    	Date date=new Date();
                    	c.setTime(date);
                    	pageContext.setAttribute("nowDate",c.getTime());
                     %>
                  <td>  填报时间：<s:date name="#attr.nowDate" format="yyyy年MM月dd日 hh:mm:ss" /></td>
                  </tr>
                  <tr>
                    <td>总金额：<label  id="sum"></label></td>
                    <td>状态：新创建</td>
                  </tr>
                </table>
                <p>&nbsp;</p>
                <form id="form1" name="form1" method="post" action="">
                <table width="90%" border="0" cellspacing="0" cellpadding="0" class="addform-item" id="mytabletr">
                
<tr>
                    <td>项目</td>
                    <td>金额</td>
                    <td>费用说明</td>
                    <td>&nbsp;</td>
                    </tr>

                 
                  <tr  id="options"><td id="td1">
                
                        <select name="select" id="select" class="input_01">
                        <option value="0">基本通讯费用</option>
                        </select></td>
                    <td id="td2"><input type="text" name="feiyong" id="textfield2" class="input_01" /></td>
                    <td id="td3"><input type="text" name="shuoming" id="textfield" class="input_01" /></td>
                
                  </tr>

                  <!--报销单事由-->
                   <tr><td colspan="4" class="event">
                    <label>事  由：</label><textarea name="textarea" id="textarea" cols="45" rows="5"></textarea>
                   </td></tr>    
                    
                  <!--表单提交行-->
                  <tr>
                    <td colspan="4" class="submit">
                    <input type="submit" name="button" id="button" value="保 存" class="submit_01" />
                    <input type="submit" name="button" id="button" value="保存并提交" class="submit_01" />
                    <input type="button" name="button" id="button" onclick="AddOption()" value="添加明细" class="submit_01" />
                    </td>
                    </tr>  
              
                </table>        </form>      
            <!--增加报销单 区域 结束-->
        </div>
    </div>
</div></div>

<div class="copyright">Copyright  &nbsp;   &copy;  &nbsp; </div>

</body>
</html>
